﻿using System;
using System.Numerics;

class FiveDifferentMethods

            // Write methods to calculate minimum, maximum, average, sum and product of given set of integer numbers. Use variable number of arguments.

{
    static void Main()
    {

        Console.Write("Enter the size of the array: ");
        int arraySize = int.Parse(Console.ReadLine());
        int[] array = new int[arraySize];
        Console.WriteLine();

        Console.WriteLine("Enter the elements of the array:");
        for (int i = 0; i < arraySize; i++)
        {
            array[i] = int.Parse(Console.ReadLine());
        }
        Console.WriteLine();

        Console.WriteLine("The minimum value of the array is: {0}", FindMin(array));
        Console.WriteLine("The maximum value of the array is: {0}", FindMax(array));
        Console.WriteLine("The average value of the array is: {0}", FindAverage(array));
        Console.WriteLine("The sum of the array is: {0}", FindSum(array));
        Console.WriteLine("The product of the array is: {0}", FindProduct(array));
        Console.WriteLine();
    }

    static int FindMin(int[] array)
    {
        int min = int.MaxValue;
        for (int index = 0; index < array.Length; index++)
        {
            if (array[index] < min)
            {
                min = array[index];
            }
        }
        return min;
    }

    static int FindMax(int[] array)
    {
        int max = int.MinValue;
        for (int index = 0; index < array.Length; index++)
        {
            if (array[index] > max)
            {
                max = array[index];
            }
        }
        return max;
    }

    static double FindAverage(int[] array)
    {
        double average = 0;
        for (int index = 0; index < array.Length; index++)
        {
            average += array[index];
        }
        average /= array.Length;
        return average;
    }

    static long FindSum(int[] array)
    {
        long sum = 0;
        for (int index = 0; index < array.Length; index++)
        {
            sum += array[index];
        }
        return sum;
    }

    static BigInteger FindProduct(int[] array)
    {
        BigInteger product = 1;
        for (int index = 0; index < array.Length; index++)
        {
            product *= array[index];
        }
        return product;
    }       
}

